import os
import pandas as pd

csv_path = '/media/imed/d9f520b2-6e7a-4842-af77-fba3ad2d8d27/test.csv'

folder_dir = '/media/imed/d9f520b2-6e7a-4842-af77-fba3ad2d8d27/test_to'

df = pd.read_csv(csv_path)

folders = os.listdir(folder_dir)

mapping = {}
for f in folders:
    for original in df['folder_name']:        #此处folder_name换成实际的csv中的标题
        if f.startswith(original):
            mapping[original] = f

df['folder_name'] = df['folder_name'].map(mapping).fillna(df['folder_name'])         #此处folder_name换成实际的csv中的标题

df.to_csv('file_list_with_suffix.csv', index=False)